package com.ymttest.database.mongo;

import java.util.ArrayList;
import java.util.Map;

import com.ymt.database.MongoDBDriver;

public class YmtShoppingCartWapper {
	private MongoDBDriver mdd = YmtMongoDriverFactroy.getInstance_YmtShoppingCartDBdriverNewJava("YmtShoppingCart");

	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public Map<String,Object> getByProductIdAndUserId(String productId, int userId) throws Exception {
		ArrayList<Map> list = mdd.selectPartLimitToMap("{\"productid\":" + productId + ", \"userid\":" + userId + "}",1);
	    
	    return list.size()>0?list.get(0):null;
	}
	     
	
	
	public static void main(String[] args) throws Exception {
		/*Map<String,Object> ret = new YmtShoppingCartWapper().getByProductId("000af2f3-2043-4fac-b0b1-cf31d2ae6f7c");
		System.out.print(ret.get("catalogid").toString());*/

	}
	    
}
